package com.web.cms.ad.service;

import com.blue.jdbc.JdbcDataSource;
import com.blue.jdbc.Page;
import com.web.cms.ad.dao.AdvPosDao;
import com.web.cms.ad.model.AdvPos;
import com.web.core.util.Const;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 广告位置业务层
 * 
 * @author 代码由 blue-code 框架生成
 * @since 1.0 2017年11月13日
 */
@Service("adAdvPosService")
@Transactional
@JdbcDataSource(Const.DS_CMS)
public class AdvPosService
{
	@Autowired
	private AdvPosDao advPosDao;
	
	public AdvPosService()
	{
	}
	
	public AdvPos save(AdvPos advPos)
	{
		if (advPos.getId() == null)
		{
			advPosDao.save(advPos);
		}
		else
		{
			advPosDao.update(advPos);
		}
		AdvPos a = advPosDao.get(advPos.getId());
		return a;
	}
	
	public AdvPos get(Integer id)
	{
		AdvPos advPos = advPosDao.get(id);
		return advPos;
	}
	
	public Page<AdvPos> list(AdvPos advPos, Page<AdvPos> page)
	{
		page = advPosDao.list(advPos, page);
		return page;
	}
	
	public List<AdvPos> list(AdvPos advPos)
	{
		List<AdvPos> list = advPosDao.list(advPos);
		return list;
	}
	
	public void delete(AdvPos advPos)
	{
		advPosDao.delete(advPos);
	}
	
}
